<template>
  <van-cell title="姓名" is-link to="/user/edit" :value="user.username" @click="userEdit('username','姓名',user.username)"/>
  <van-cell title="账户" :value="user.userAccount"/>
  <van-cell title="头像" is-link to="/user/edit">
    <img style="height:48px":src="user.avatarUrl">
  </van-cell>
  <van-cell title="性别" is-link to="/user/edit" :value="user.gender" />
  <van-cell title="电话" is-link to="/user/edit" :value="user.phone" />
  <van-cell title="邮箱" is-link to="/user/edit" :value="user.email" />
  <van-cell title="地球号" is-link to="/user/edit" :value="user.planetCode" />
  <van-cell title="创建日期" arrow-direction="down" :value="user.createTime.toDateString()" />
</template>

<script setup lang="ts">
import {useRouter} from "vue-router";

const user = {
  id: 9527,
  username: 'shayu',
  userAccount: 931,
  avatarUrl: 'https://xinggiu-tuchuang-1256524210.cos',
  gender: '男',
  phone: '430821',
  email: 'shayu-yusha@qq.com',
  planetCode: '931',
  createTime: new Date()
}
const router = useRouter();
const userEdit = (editKey:string,editName:string,editValue:string) => {
  router.push({
    path: '/user/edit',
    query: {
      editKey,
      editName,
      editValue
    }
  })

}
</script>

<style scoped>

</style>